﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using com.huigo.Framework.ServiceUtils;
using com.loto.Common;
using com.huigo.Framework.Passport;

namespace com.huigo.B2B.Web.ctrl
{
    public partial class headLogin : System.Web.UI.UserControl
    {
        public string post
        {
            get
            {
                return Request.QueryString["isPost"];
            }
        }
        public string custName
        {
            get
            {
                return Request.QueryString["Name"];
            }
        }
        public string password
        {
            get
            {
                return Request.QueryString["Pwd"];
            }
        }
        public string strValue = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (CustPassport.ChkCookieLogin())
            {
                string count = "0";
                List<RequestFuncParams> list = new List<RequestFuncParams>();
                list.Add(new RequestFuncParams("custFid", CustPassport.GetCookieUserId().ToString()));
                BaseService service = new BaseService();
                ParserXml parser = service.RequestEntryService(Dict.ERequestFunc.GET_PROBLEM_POLICY_COUNT, list);
                if (parser != null)
                {
                    count = parser["returnargs", 0];
                }

                strValue = "<div style=\"line-height:35px;\">您好，" + CustPassport.GetCookieUserName() + "&nbsp;&nbsp;<a href=\"/Logout.aspx\" style=\"color:white;\">[退出]</a>&nbsp;&nbsp;&nbsp;<a href=\"/center/order/OrderList.aspx\" style=\"color:white;\">我的订单</a>&nbsp;&nbsp;&nbsp;<a href=\"/center/order/ProblemPolicy.aspx\" style=\"color:white;\">问题订单(" + count + ")</a></div>";
            }
            else
            {
                strValue = "<div style=\"line-height:35px;\"><input class=\"span2\" type=\"text\" name=\"Name\" id=\"Name\" placeholder=\"用户名\">&nbsp;&nbsp;<input class=\"span2\" type=\"password\" id=\"Pwd\" name=\"Pwd\" placeholder=\"密码\">&nbsp;&nbsp;<input type=\"hidden\" name=\"isPost\" value=\"true\" /><a class=\"btn\" onclick=\"javascript:Login();\">登录</a>&nbsp;&nbsp;<a href=\"/register.aspx\" style=\"color:white;\">注册</a></div>";
            }            
        }
    }
}